<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>jquery实现多级树形分类可折叠菜单特效代码</title>

    <!--图标样式-->
    <link rel="stylesheet" type="text/css" href="/tree/css/bootstrap.min.css"/>

    <!--主要样式-->
    <link rel="stylesheet" type="text/css" href="/tree/css/style.css"/>

    <script type="text/javascript" src="/tree/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/tree/js/test.js"></script>

    <script type="text/javascript">
        $(function () {
            $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', '关闭');
            $('.tree li.parent_li > span').on('click', function (e) {
                console.log(e);
                var children = $(this).parent('li.parent_li').find(' > ul > li');
                if (children.is(":visible")) {
                    children.hide('fast');
                    $(this).attr('title', '展开').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
                } else {
                    children.show('fast');
                    $(this).attr('title', '关闭').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
                }
                e.stopPropagation();
            });
        });
    </script>
</head>
<body>

<div class="tree well">

    <ul id="rootUL">

    </ul>
</div>


</body>
</html>